package com.group5.onlinegame.service;

import com.group5.onlinegame.dao.IProductDao;
import com.group5.onlinegame.entity.Product;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestParam;

import javax.annotation.Resource;
import java.util.List;

@Service
public class ProductImpl implements IProductService {

    @Resource
    private IProductDao iProductDao;

    @Override
    public List<Product> getProductList(@RequestParam(value = "id") Integer id) {
        return iProductDao.getProductListById(id);
    }

    //修改商品信息
    @Override
    public boolean editProduct(String name, Integer costGolds, Integer costIngots, String photo, Integer amount, Integer saleNum, String description, Integer id) {
        return iProductDao.editProduct(name,costGolds,costIngots,photo,amount,saleNum,description,id);
    }

    //修改商品状态
    @Override
    public boolean editStatus(String status,Integer id) {
        return iProductDao.editStatus(status,id) ;
    }

    //增加商品
    @Override
    public boolean addProduct(Integer typeId, String name, Integer costGolds, Integer costIngots, Integer amount, Integer saleNum, String photo, String description, String isNeedAdress, String status, Integer id) {
        return iProductDao.addProduct(typeId,name,costGolds,costIngots,amount,saleNum,photo,description,isNeedAdress,status,id);
    }

    //批量删除
    @Override
    public Integer deleteMany(String[] ids) {
        return iProductDao.deleteMany(ids);
    }

    //导出Excel
    @Override
    public List<Product> getProductExcel(@RequestParam(value = "id")Integer id) {
        return iProductDao.getProductExcel(id);
    }


}
